package routes

import (
	"github.com/goravel/framework/contracts/route"
	"github.com/goravel/framework/facades"
	"goravel/app/http/controllers"
	"goravel/app/http/controllers/model"
	"goravel/app/http/controllers/system"
	"goravel/app/http/controllers/user"
)

func Admin() {
	facades.Route().Prefix("api/v1/admin").Group(func(router route.Router) {
		//系统接口
		router.Prefix("common").Group(func(router_common route.Router) {
			upload_service_ctrl := controllers.NewUploadController()

			router_common.Post("/upload", upload_service_ctrl.Upload)
		})

		router.Prefix("user").Group(func(router_user route.Router) {
			//用户等级
			user_level_ctrl := system.NewSystemUserLevelController()

			router_user.Resource("user_level", user_level_ctrl)
			//router_user.Get("user_level/list", user_level_ctrl.List)
			//用户标签分类
			category_ctrl := model.NewCategoryController()
			router_user.Resource("category", category_ctrl)

			//用户标签
			user_label_ctrl := user.NewUserLabelController()
			router_user.Resource("cate/{cid}/user_label", user_label_ctrl)

			//用户分组
			user_group_ctrl := user.NewUserGroupController()
			router_user.Resource("user_group", user_group_ctrl)

			//用户管理
			user_ctrl := user.NewUserController()
			router_user.Resource("user", user_ctrl)
		})

		router.Prefix("system").Group(func(router_system route.Router) {

			//配置的tab标签
			system_config_tab_ctrl := system.NewSystemConfigTabController()
			router_system.Get("config_tab/tree", system_config_tab_ctrl.Tree)
			router_system.Resource("config_tab", system_config_tab_ctrl)

			//配置的值设置
			system_config_ctrl := system.NewSystemConfigController()
			router_system.Resource("config", system_config_ctrl)
			router_system.Get("cfg_tab/{cid}/config", system_config_ctrl.FormRender)
			router_system.Post("cfg_tab/{cid}/config", system_config_ctrl.FormInput)

			//	文件管理-文件夹
			sys_attachment_category_ctrl := system.NewSystemAttachmentCategoryController()
			router_system.Resource("attachment_category", sys_attachment_category_ctrl)
			router_system.Get("attachment_category/{id}/inner", sys_attachment_category_ctrl.Inner)
			//  文件管理-文件
			sys_attachment_ctrl := system.NewSystemAttachmentController()
			router_system.Resource("attachment", sys_attachment_ctrl)

			//系统菜单
			menu_ctrl := system.NewSystemMenuController()
			router_system.Get("menu/tree", menu_ctrl.Tree)
			router_system.Resource("menu", menu_ctrl)
		})
	})
}
